package com.utilities;

import java.util.ArrayList;
import java.util.Dictionary;


import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;

import com.hearwego.R;

import android.content.Context;
import android.util.Log;

public class Utilities {
	   public static final String MainUrl = "http://www.smartthinking.com.mx:8080/HearWeGo/DataServlet?Query=";
	   public static final String QRYURL =  "http://173.199.160.44:8080/hearwego/DataServlet?Query=";
	   public static final String complementUri = "&BaseDatos=hearweg_hwg";
	   
	   
		public static boolean isNetwork(){
	    	boolean bool = false;
	    	HttpGet requestForTest = new HttpGet("http://m.google.com");
	    	try {
	    		new DefaultHttpClient().execute(requestForTest); // can last...
	    		bool = true;
	    	} catch (Exception e) {

	    	}
	    	return bool;
	    }

		//CHECA LA CONEXION A INTERNET
		public boolean isOnline() {
	    	boolean bool = false;
	    	HttpGet requestForTest = new HttpGet("http://m.google.com");
	        try {
	            new DefaultHttpClient().execute(requestForTest); // can last...
	            bool = true;
	        } catch (Exception e) {}
			return bool;
		}

	   //Your other constants, if you have them..
		public  static ArrayList<Dictionary<String, String>> qry (Context ctx, String strCadena){
			ArrayList<Dictionary<String, String>> Resultados = null;
	    	String URL = ctx.getString(R.string.QRY) + strCadena+complementUri;
//			Log.i("URL", ""+URL);
			saxXML saxparser = new saxXML(URL);
			
			
			try {
				Resultados = saxparser.parse(0);
				Log.i("URL","" + URL);
			} catch (Exception e) {
				
			}
			return Resultados;
		}
		
		

}
